# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-delegator
pkgname=('python2-delegator' 'python-delegator')
_pkgname=delegator
pkgver=0.0.3
pkgrel=11
pkgdesc="Python implementation of Ruby’s delegate.rb."
arch=('any')
url='https://pypi.org/project/delegator/#files'
license=('MIT')
depends=('python')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('851a0097eeca08cd3c703e38caba8791c70c774fbccb7311f753c4c3c0c4aa953d67851057cf30d62ef68642df00234d78ec351af267c4eaccc93a2739fd76ad')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-delegator() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-delegator() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

